package com.zjht.gmcc.bean.action;

import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.zjht.gmcc.bean.util.MyJDBC;

public class AssessUtil implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

	public static final String ASS_RETURN_NORMAL="0";//质量回访考核正常
	public static final String ASS_RETURN_ABNORMAL="1";//质量回访考核异常
	public static final String ASS_RETURN_STOP_OUTSIDE="80";//质量回访不推荐外省
	public static final String ASS_RETURN_STOP_COOPER="81";//质量回访停止合作
	public static final String ASS_RETURN_PERMIT_AGAIN="82";//质量回访重新认证
	/**
	 * 获取考核结果
	 * @author 孙汉斌 2011-11-27
	 * @param assess
	 */
	public static String getAssessResult(String assess) {
		return "0".equals(assess) ? "正常" : "异常";
	}

	/**
	 * 根据paraname,parentid取paraid
	 * @author 孙汉斌 2011-12-06
	 * @param parametername
	 * @return paraid
	 */

	public static String getParaID(String paraname, String parentid) {
		String paraid = "";
		MyJDBC myJDBC = null;
		try {
			myJDBC = new MyJDBC();
			String sql = "SELECT paraid FROM Parameter WHERE paraname=? AND parentid=?";
			PreparedStatement ps = myJDBC.prepareStatement(sql);
			ps.setString(1, paraname);
			ps.setString(2, parentid);
			ResultSet rs = ps.executeQuery();
			if (rs.next()) {
				paraid = rs.getString(1);
			}
			rs.close();
			rs = null;
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			MyJDBC.close(myJDBC);
		}
		return paraid;
	}

}
